package skipset

import "github.com/DiracLee/skiplist-go/internal/fastrand"

const (
	p = 0.25
)

// 生成 1..=maxHeight 的随机高度
func randomHeight() int {
	level := 1
	for fastrand.U32n(1/p) == 0 {
		level++
	}
	if level > maxHeight {
		return maxHeight
	}
	return level
}
